// stringUpper(obj); // coloca texto em letra maiuscula function stringUpper(obj){ obj.value = obj.value.toUpperCase(); } // tabFormInput(obj:obj, qtdMaxCaractere:int, e:event); // Calcula tabulacao dos input function tabFormInput(obj, qtdMaxCaractere, idProx, e){ var tecla=(window.event)?event.keyCode:e.which; // se nao tiver pressionado delete e nem backspace continua if (tecla != 8 && tecla != 46){ if (obj.value.length >= qtdMaxCaractere){ if (idProx != ""){ document.getElementById(idProx).focus(); document.getElementById(idProx).value = ""; } } } } // tabFormSelect(idProx:id); // Calcula tabulacao dos selext function tabFormSelect(idProx){ if (idProx != ""){ document.getElementById(idProx).focus(); } } // formataTelefone(e:event); // Permite somente caracteres utilizados em telefone function formataTelefone(e){ var tecla=(window.event)?event.keyCode:e.which; if((tecla > 47 && tecla < 58) || (tecla == 9 || tecla == 46) || (tecla == 13) || (tecla == 32) || (tecla == 45) || (tecla == 37 || tecla == 39) || (tecla == 40 || tecla == 41)) { return true; } else { if (tecla != 8) return false; else return true; } } // Formata numero colocando parentese function formaTelefoneParentese(obj) { setTimeout(function(){ var value = obj.value; value = value.replace(/[^\d]+/g,""); value = value.replace(/^(\d{2})(\d)/g,"($1) $2"); value = value.replace(/(\d)(\d{4})$/,"$1-$2"); obj.value = value; }, 0); } // Formata CNPJ function formaCnpj(obj) { // Display none if($('#campoCnpj')){ $('#campoCnpj').css('display', 'none'); } // Esse seTime só serve pra se caso o cara clicar com o botão direito e colar setTimeout(function(){ var value = obj.value; //value = value.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{3})/g,"$1.$2.$3-$4/$5-$6"); value = value.replace(/[^\d]+/g,""); value = value.replace(/^(\d{2})(\d)/g,"$1.$2"); value = value.replace(/(\d{2})\.(\d{3})(\d)/g,"$1.$2.$3"); value = value.replace(/\.(\d{3})(\d)/g,".$1/$2"); value = value.replace(/(\d{4})(\d)/g,"$1-$2"); //if(value.length == 19) { //if(!validaCnpj(value)) { // if($('#campoCnpj')){ // $('#campoCnpj').css('display', 'none'); //} //value = ''; //} //} obj.value = value; }, 0); } // Se caso o cara clicar em colar, também remove function removeNumerosContato(obj) { setTimeout(function(){ obj.value = obj.value.replace(/[^a-zA-Z]/g,''); }, 0); } // Forma o cep function formaFax(obj) { setTimeout(function(){ var value = obj.value; value = value.replace(/[^\d]+/g, ''); value = value.replace(/^(\d{2})(\d)/g,"$1-$2"); value = value.replace(/(\d{2})\-(\d{4})(\d)/g,"$1-$2-$3"); value = value.replace(/(\d{2})\-(\d{4})\-(\d{4})/g,"$1-$2-$3"); obj.value = value; }, 0); } // função que forma a data do ano do veículo function formaDataVeiculo(obj) { var value = obj.value; value = value.replace(/[^\d]+/g, ''); value = value.replace(/^(\d{4})(\d)/g,"$1/$2"); value = value.replace(/^(\d{4})\/(\d{4})(\d)/g,"$1/$2"); obj.value = value; } // formataLogin(e:event); // Permite somente letras, numeros e underline function formataLogin(e){ var tecla=(window.event)?event.keyCode:e.which; if((tecla >= 65 && tecla <= 90)||(tecla >= 97 && tecla <= 122)||(tecla > 47 && tecla < 58) || (tecla == 95) || (tecla == 9) || (tecla == 46) || (tecla == 13)) return false; //else{ //if (tecla != 8) return false; //else return true; //} } // Remove qualquer caractere invalido function loginCaractereInvalidos(e) { e.value = e.value.replace(/[^A-Za-z0-9@._-]/g, ""); } // SomenteNumero(e:event); // Pemite somente numeros function SomenteNumero(e){ var tecla=(window.event)?event.keyCode:e.which; if((tecla > 47 && tecla < 58) || (tecla == 9 || tecla == 46) || (tecla == 13) || (tecla == 37 || tecla == 39)) { return true; } else { if (tecla != 8) return false; else return true; } } // SomenteDouble(e:event); // Pemite somente numeros e ponto function SomenteDouble(e){ var tecla=(window.event)?event.keyCode:e.which; if((tecla > 47 && tecla < 58) || (tecla == 9 || tecla == 46) || (tecla == 13) || (tecla == 46) || (tecla == 37 || tecla == 39)) { return true; } else { if (tecla != 8) return false; else return true; } } // SomenteLetras(e:event); // Permite somente letras function SomenteLetras(e){ var tecla=(window.event)?event.keyCode:e.which; if((tecla >= 65 && tecla <= 90)||(tecla >= 97 && tecla <= 122) || (tecla == 9 || tecla == 46) || (tecla == 13) || (tecla == 37 || tecla == 39)) return true; else{ if (tecla != 8) return false; else return true; } } // SomenteLetras(e:event); // Permite somente letras function SomenteLetrasNumeros(e){ var tecla=(window.event)?event.keyCode:e.which; if((tecla >= 65 && tecla <= 90)||(tecla >= 97 && tecla <= 122) || (tecla == 9 || tecla == 46) || (tecla == 13) || (tecla == 37 || tecla == 39) || (tecla > 47 && tecla < 58) || (tecla == 9 || tecla == 46) || (tecla == 13) || (tecla == 37 || tecla == 39)) return true; else{ if (tecla != 8) return false; else return true; } }